package com.shycloud.mido.organ.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.shycloud.mido.organ.api.dto.PurchaserDTO;
import com.shycloud.mido.organ.api.dto.StudentPurchaseDTO;
import com.shycloud.mido.organ.api.entity.StudentPurchaseEntity;
import com.shycloud.mido.organ.api.entity.StudentRefundEntity;
import org.apache.ibatis.annotations.Param;

import java.util.List;

public interface StudentPurchaseMapper extends BaseMapper<StudentPurchaseEntity> {

	/**
	 * @author: Cxc
	 * @Date: 2019/9/25 16:10
	 * @Description: 购课陪练剩余查询
	 */
	List<StudentPurchaseEntity> selectStudentPurchaseById(@Param("entity") StudentPurchaseEntity studentPurchaseEntity);

	/**
	 * @author: Cxc
	 * @Date: 2019/10/11 14:36
	 * @Description: 更新购课数量
	 */
	boolean updateSum(@Param("entity") StudentPurchaseDTO studentPurchaseDTO);

	/**
	 *  获取学生单驱剩余课节数
	 * @param studentPurchaseEntity StudentPurchaseEntity
	 * @return 剩余课节数
	 */
	String getStudentSinglePurchase(@Param("query") StudentPurchaseEntity studentPurchaseEntity);

	/**
	 *  获取学生双驱剩余课节数
	 * @param studentPurchaseEntity StudentPurchaseEntity
	 * @return 剩余课节数
	 */
	String getStudentDoublePurchase(@Param("query") StudentPurchaseEntity studentPurchaseEntity);

	/**
	 * @author: Cxc
	 * @Date: 2019/10/19 14:26
	 * @Description: 通过机构id查询所有学生(三级联动)
	 */
	List<StudentPurchaseDTO> selectStudentByOrgId(StudentPurchaseDTO studentPurchaseDTO);

	/**
	 * @author: Cxc
	 * @Date: 2019/10/19 14:26
	 * @Description: 通过该学生 查询科目类型(三级联动)
	 */
	List<StudentPurchaseDTO> selectPurchaseByStudentId(StudentPurchaseDTO studentPurchaseDTO);

	/**
	 * @author: Cxc
	 * @Date: 2019/10/19 14:26
	 * @Description:   通过该学生科目机构id 查询单屈还是双驱类型(三级联动)
	 */
	List<StudentPurchaseDTO> selectPurchaseByStudentType(StudentPurchaseDTO studentPurchaseDTO);

	/**
	 * @author: Cxc
	 * @Date: 2019/10/19 16:18
	 * @Description: 修改订单总数量
	 */
	boolean updatePurchaseId(StudentRefundEntity studentRefundEntity);

	/**
	 * 学生详情列表
	 * @param studentId
	 * @return
	 */
	List<StudentPurchaseEntity>  studentPurchaseList(@Param("studentId") String studentId);

	/**
	 * 机构课程详情
	 * @param page
	 * @param type 0 单驱 1双驱
	 * @param orgId 机构ID
	 * @param name 学生姓名
	 * @return
	 */
	IPage<PurchaserDTO> orgPurchase(Page page,@Param("type") String type, @Param("orgId") String orgId, @Param("name") String name);
}
